import React, { lazy } from 'react';
import {
  HomeOutlined,
  SettingFilled,
  SmileOutlined,
  FormOutlined,
  UserOutlined,
  StarOutlined,
  WarningOutlined,
  FrownOutlined,
} from '@ant-design/icons';

import BasicLayout from '@/layouts/BasicLayout';
import BlankLayout from '@/layouts/BlankLayout';

const config = [
  {
    path: '/',
    component: BlankLayout, // 空白页布局
    childRoutes: [
      // 子菜单路由
      {
        path: '/login', // 路由路径
        name: '登录页', // 菜单名称 (不设置,则不展示在菜单栏中）
        component: lazy(() => import('@/pages/Login')), // 懒加载 路由组件
      },
      {
        path: '/',
        // exact: true,
        component: BasicLayout, // 基本布局
        childRoutes: [
          {
            path: '/welcome',
            name: '欢迎页',
            icon: <SmileOutlined />,
            component: lazy(() => import('@/pages/Welcome')),
          },

          {
            path: '/system',
            name: '项目配置',
            icon: <SettingFilled />,
            childRoutes: [
              {
                path: '/system/dbConfig',
                name: '数据库设置',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/DBConfig')),
              },
              {
                path: '/system/jarConfig',
                name: '监控包位置配置',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/JarConfig')),
              },
              {
                path: '/system/interface_manager',
                name: '监控接口配置',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/Interface_manager')),
              },
              {
                path: '/system/classprefix',
                name: '包名前缀设置',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/Classprefix')),
              },
              {
                path: '/system/method_class_4callee',
                name: '向上调用链方法入口',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/Method_class_4callee')),
              },
              {
                path: '/system/method_class_4caller',
                name: '向下调用链方法入口',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/Method_class_4caller')),
              },
              {
                path: '/system/runconfig',
                name: '运行环境设置',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/System/Runconfig')),
              },
            ],
          },

          {
            path: '/formDemo',
            name: '项目运行',
            icon: <FormOutlined />,
            component: lazy(() => import('@/pages/FormDemo')),
          },

          {
            path: '/codeMonitor',
            name: '代码监控',
            icon: <FormOutlined />,
            childRoutes: [
              {
                path: '/codeMonitor/interface_monitor',
                name: '接口监控',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/CodeMonitor/Interface_monitor')),
              },
              {
                path: '/codeMonitor/method_class_4callee',
                name: '向上调用列表',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/CodeMonitor/Method_class_4callee_monitor')),
              },
              {
                path: '/codeMonitor/method_class_4caller',
                name: '向下调用列表',
                icon: <StarOutlined />,
                component: lazy(() => import('@/pages/CodeMonitor/Method_class_4caller_monitor')),
              },
            ],
          },

          {
            path: '/exception',
            name: '异常页',
            // exact: true,
            icon: <WarningOutlined />,
            childRoutes: [
              {
                path: '/exception/403',
                name: '403',
                icon: <FrownOutlined />,
                component: lazy(() => import('@/pages/Exception/403')),
              },
              {
                path: '/exception/404',
                name: '404',
                exact: true,
                icon: <FrownOutlined />,
                component: lazy(() => import('@/pages/Exception/404')),
              },
              {
                path: '/exception/500',
                name: '500',
                icon: <FrownOutlined />,
                component: lazy(() => import('@/pages/Exception/500')),
              },
            ],
          },
          { path: '/', exact: true, redirect: '/welcome' },
          { path: '*', exact: true, redirect: '/exception/404' },
        ],
      },
    ],
  },
];

export default config;
